import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import React from 'react';
import { Modal, Spin } from 'antd';
import { Button as ButtonPermission } from 'components/Permission';
import intl from 'utils/intl';
import styles from "./index.less?modules";
/**
 * 接收人数据展示列表
 * @extends {PureComponent} - React.PureComponent
 * @reactProps {Function} onOk - 确认之后的回调函数
 * @reactProps {Boolean} contentVisible - 收件人模态框是否可见
 * @reactProps {Object} content - 内容信息
 * @reactProps {Object} error - 错误信息
 * @return React.element
 */

var ContentView = /*#__PURE__*/function (_React$PureComponent) {
  _inherits(ContentView, _React$PureComponent);

  var _super = _createSuper(ContentView);

  function ContentView() {
    _classCallCheck(this, ContentView);

    return _super.apply(this, arguments);
  }

  _createClass(ContentView, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          contentVisible = _this$props.contentVisible,
          onOk = _this$props.onOk,
          content = _this$props.content,
          isContent = _this$props.isContent,
          error = _this$props.error,
          loading = _this$props.loading,
          path = _this$props.path; // eslint-disable-next-line no-nested-ternary

      var modalContent = loading ? null : isContent ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, content.subject), /*#__PURE__*/React.createElement("div", {
        className: styles.content,
        dangerouslySetInnerHTML: {
          __html: content.content
        }
      })) : /*#__PURE__*/React.createElement("pre", {
        style: {
          height: '300px',
          overflowY: 'scroll'
        }
      }, error.transactionMessage);
      return /*#__PURE__*/React.createElement(Modal, {
        title: isContent ? intl.get('cmsg.messageQuery.model.messageQuery.content').d('内容') : intl.get('cmsg.messageQuery.model.messageQuery.error').d('错误'),
        width: 700,
        destroyOnClose: true,
        visible: contentVisible,
        closable: false,
        footer: /*#__PURE__*/React.createElement(ButtonPermission, {
          permissionList: [{
            code: "".concat(path, ".button.saveContent"),
            type: 'button',
            meaning: '消息查询-内容确定'
          }],
          type: "primary",
          onClick: onOk
        }, intl.get('cpaas.common.button.sure').d('确定'))
      }, /*#__PURE__*/React.createElement(Spin, {
        spinning: loading
      }, modalContent));
    }
  }]);

  return ContentView;
}(React.PureComponent);

export { ContentView as default };